package com.sm.healthy.data.dao

import androidx.lifecycle.LiveData
import androidx.room.*
import com.sm.healthy.data.bean.BloodPressureEntity

/**
 * @description
 * @author csw
 * @date 2021-05-05
 */
@Dao
interface BloodPressureDao {
    @Insert
    suspend fun insert(bloodPressureEntity: BloodPressureEntity)

    @Update
    suspend fun update(bloodPressureEntity: BloodPressureEntity)

    @Delete
    suspend fun delete(bloodPressureEntity: BloodPressureEntity)

    @Query("Delete FROM bloodPress")
    suspend fun deleteAll()

    @Query("SELECT * FROM bloodPress")
    fun getBloodPressure(): LiveData<List<BloodPressureEntity>>

    @Query("SELECT * FROM bloodPress WHERE timeLong >:before and timeLong <:after")
    fun getBloodPressureByTime(before: Long, after: Long): LiveData<List<BloodPressureEntity>>
}